package com.csy.utils;

import com.csy.bean.ConsumerComponet;

public class ConsumerThread implements Runnable{

    private String method;
    private ConsumerComponet service;
    public ConsumerThread(String methodName, ConsumerComponet consumerComponet){
        method = methodName;
        service = consumerComponet;
    }

    @Override
    public void run() {
        while (true) {
            try {
                switch (method) {
                    case "A":
                        service.methodA();
                        break;
                    case "B":
                        service.methodB();
                        break;
                    case "C":
                        service.methodC();
                        break;
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

}
